/*This file is part of AENIMA. AENIMA is a module of BCI++ framework for the implementation of brain computerinterface systems. 
AEnima is intended for use with BCI++ only.

BCI++ is a project of the Sensibilab of the Politecnico di Milano. 

AENIMA is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation, either version 3 of 
the License, or (at your option) any later version.

AENIMA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License
and the GNU Lesser General Public License along with AENIMA.  
If not, see <http://www.gnu.org/licenses/>.*/

/*!
	\file	GraphicEngine.h
	 Graphics header file class.\n
	 This class is developed in order to manage Irrlicht graphics engine.
	
	\author	Paolo Perego E-Mail: thewizard83@hotmail.com\n
			Luca Maggi E-Mail: luca.maggi@polimi.it\n
			Sergio Parini	E-Mail: sergio.parini@polimi.it

	\date	2007-09-06 creation \n
		2008-01-27 last modification

	\b COPYRIGHT: 
		This program is property of Sensibilab - Campus Ponit - Lecco
*/

#pragma once

#include "GraphicEngine_base.h"

using namespace irr;

#pragma comment(lib, "Irrlicht.lib")


/*!\class GraphicEngine
Class for the graphics management*/
class GraphicEngine : public GraphicEngine_base
{
public:
	/*!\fn GraphicEngine(void)
	In this class constructor  the graphics engine is initialized. In this point the video driver,
	the resolution, the camera position and the cursor visualization are set.*/
	GraphicEngine(void);
	~GraphicEngine(void);
	/*!\fn void AnimatedSkydome(char *SkyTexPath)
	Function to generate the sky dome (rotating wallpaper).
	\param SkyTexPath This is the path of the image file for the sky dome. This picture must not have
	a high resolution to avoid the overload of the graphics engine.*/
	void AnimatedSkydome(char *SkyTexPath);
	/*!\fn void EnvironmentalDrawings(void)
	This function draws all the objects; at the execution the sky dome is loaded and a fog and 
	glow effect is generated.*/
	void EnvironmentalDrawings(void);
	/*!\fn void ObjectDrawings(void)
	Function to generate the Irrlicht object. When the function is used, all the graphics objects
	are generated. All the objects have a univocal name and are set invisible.*/
	void ObjectDrawings(void);
	/*!\fn void ExEngine()
	Function for running the graphics Engine. With this function all the graphics object are drown on the screen
	This function must be call continuously to update the graphics.*/
	void ExEngine(void);
	/*!\fn void ExEngine()
	Clean cache and remove old textures and meshes from memory*/
	void FlushAll(void);
	/*!\fn void LoadBuiltInResources(void)
	This function calls ObjectDrawings and EnvironmentalDrawings methods*/
	void LoadBuiltInResources(void);
	/*!\fn	void RestartEngine(void)
	This methods Reset the Engine cleaning memory*/
	void RestartEngine(void);
	/*!\fn 	void InitEngine(void)
	Inizialize the engine with the parameters passed by command line.*/	
	void InitEngine(void);
	/*!\fn void ConfigEngine(char *driverSelected,int hres,int vres, char *mode, char* bitcolor, char* vsinch)
	Read command line and inizialize parameters value for the initialization of the engine. */
	void ConfigEngine(char *driverSelected,int hres,int vres, char *mode, char* bitcolor, char* vsinch);
	/*!\fn void DrawCentered2DImage(video::ITexture* CenterTexture)
	This function draw a 2d centerd image on the screen.*/
	void DrawCentered2DImage(video::ITexture* CenterTexture);
	/*!\fn scene::IParticleSystemSceneNode* ParticleSystem(scene::ISceneNode* ParentNode,core::vector3df Position, core::vector3df EmiDirection,u32 nMin, u32 nMax, video::SColor MinStartColor, video::SColor MaxStartColor, s32 Angle)
	This function is used to create particle effects.
	\param ParentNode Parent object to which the Particle effects is joined;\n
	\param Position x,y,z position of the effect;\n
	\param EmiDirection Direction of the effect, the direction with the life span of the particles defines the single particles speed;
	\param nMin Min number of particles for second;
	\param nMax Max number of particles for second;
	\param MinStartColor Initial color (scolor alfa,RGB);
	\param MaxStartColor Final finale (scolor alfa,RGB);
	\param Angle Diffusion angle respect to emiDirection.
	The minimum and maximum lifespan of the particle are fixed to 100 and 500 milliseconds.*/
	scene::IParticleSystemSceneNode* ParticleSystem(scene::ISceneNode* ParentNode,core::vector3df Position, core::vector3df EmiDirection, u32 nMin,u32 nMax, video::SColor MinStartColor, video::SColor MaxStartColor, s32 Angle);
	/*!\fn void SplashScreen(video::ITexture* imgScreenShot);
	This function show an image for about 3 seconds*/
	void SplashScreen (void);
	void RealisticWaterNode(f32 tileSize, u32 tileCount, core::dimension2di RenderTargetSize);
	void GLShaderFX(bool BloomON,bool ColorON);
};